﻿using Microsoft.Extensions.Configuration;
using System;

namespace ESTAR.CommandService
{
    class Program
    {
        static void Main(string[] args)
        {
            var env = Environment.GetEnvironmentVariable("ASPNETCORE_ENVIROMENT");
            IConfigurationBuilder builder = new ConfigurationBuilder().AddJsonFile(string.IsNullOrEmpty(env) ? "appsettings.json" : $"appsettings.{env}.json");
            IConfigurationRoot configuration = builder.Build();

            Bootstrap.Initialize(configuration);
            Bootstrap.Start();
            Console.WriteLine("Press enter to exit...");
            var line = Console.ReadLine();
            while (line != "exit")
            {
                switch (line)
                {
                    case "cls":
                        Console.Clear();
                        break;
                    default:
                        return;
                }
                line = Console.ReadLine();
            }
        }
    }
}
